package cn.jetpiece.cloud.resource.api;

import cn.jetpiece.cloud.resource.api.mode.query.ResourceQuery;
import cn.jetpiece.cloud.resource.api.mode.result.ResourceResult;
import cn.jetpiece.cloud.model.page.PageResult;
import cn.jetpiece.cloud.model.response.Result;
import cn.jetpiece.cloud.resource.annotation.annotation.ApiResource;
import cn.jetpiece.cloud.resource.annotation.annotation.ScanResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author XuJZ
 * @since 2020/1/19
 */
@Api(tags = "资源")
@ApiResource
public interface ResourceApi {

    String API = "/common/api/resources";

    /**
     * 分页获取资源
     *
     * @author XuJZ
     * @since 2020-01-09
     */
    @ApiOperation("分页获取资源")
    @ScanResource(path = API, method = RequestMethod.GET)
    Result<PageResult<ResourceResult>> page(ResourceQuery query);

    /**
     * 通过url查询资源信息
     * @param url
     * @param httpMethod
     * @return
     */
    @ApiOperation("分页获取资源")
    @ScanResource(path = API + "/getByUrl", method = RequestMethod.GET)
    ResourceResult getByUrl(@RequestParam(name = "url") String url, @RequestParam(name = "httpMethod") String httpMethod);

}
